import request from "@/utils/request";
import type { Brand, BrandResponseData } from "./type";

enum API {
    BRAND_URL = '/admin/product/baseTrademark/',
    ADDBRAND_URL = '/admin/product/baseTrademark/save',
    UPDATEBRAND_URL = '/admin/product/baseTrademark/update',
    DELETEBRAND_URL = '/admin/product/baseTrademark/remove/',
}

export const reqBrand = (page: number, limit: number) => request.get<any, BrandResponseData>(API.BRAND_URL + `${page}/${limit}`,)

export const reqAddUpdataBrand = (data: Brand) => {
    if (data.id) {
        return request.put<any, any>(API.UPDATEBRAND_URL, data)
    } else {
        return request.post<any, any>(API.ADDBRAND_URL, data)
    }
}

export const reqDeleteBrand = (id: number) => request.delete<any, any>(API.DELETEBRAND_URL + id)
